//
//  StreamManager.m
//  Pennyworth Punch Clock
//
//  Created by Chris Karr on 7/24/08.
//  Copyright 2008 Northwestern University. All rights reserved.
//

#import "StreamManager.h"


@implementation StreamManager

- (IBAction) updateStream:(id) sender
{
	[updateWindow orderOut:sender];
	
	NSManagedObject * stream = [[streamsController selectedObjects] lastObject];
	
	if (stream != nil && [[stream valueForKey:@"userEditable"] boolValue])
	{
		NSString * string = [sliceLabel stringValue];
		
		NSMutableDictionary * note = [NSMutableDictionary dictionary];
		[note setValue:[stream valueForKey:@"name"] forKey:KEY];
		[note setValue:string forKey:PREDICTION];
		
		[[NSNotificationCenter defaultCenter] postNotificationName:PREDICTION_FETCHED object:self userInfo:note];
	}
}

- (IBAction) invokeUpdateWindow:(id) sender
{
	[updateWindow makeKeyAndOrderFront:sender];
}

@end
